import { request } from '@/utils/request.js'

export default {

  /**
   * 获取验证码
   * @returns
   */
  getCaptch() {
    return request({
      url: 'system/captcha',
      method: 'get'
    })
  },

  /**
   * 用户登录
   * @param {object} params
   * @returns
   */
  login(params = {}) {
    return request({
      url: 'system/login',
      method: 'post',
      data: params
    })
  },

  /**
   * 用户钉钉登录
   * @param {object} params
   * @returns
   */
  dingLogin(params = {}) {
    return request({
      url: 'system/dingLogin',
      method: 'post',
      data: params
    })
  },

  /**
   * 用户退出
   * @param {object} params
   * @returns
   */
  logout(params = {}) {
    return request({
      url: 'system/logout',
      method: 'post',
      data: params
    })
  },

  /**
   * 获取登录用户信息
   * @param {object} params
   * @returns
   */
  getInfo(params = {}) {
    return request({
      url: 'system/getInfo',
      method: 'get',
      data: params
    })
  },

  /**
   * 设置仓库
   * @param {object} data
   * @returns
   */
  setDepot(data = {}) {
    return request({
      url: 'system/currentDepot',
      method: 'post',
      data
    })
  },
  getWxConfig(){
    return request({
      url: 'system/wwLogin',
      method: 'get',
    })
  },
  wwLogin(code){
    return request({
      url: 'system/wwLogin',
      method: 'post',
      data:{
        code:code
      }
    })
  }
}
